<%
config = active_scaffold_config_for(@record.class)
columns = @record.new_record? ? config.create.columns : config.update.columns
%>
<ol>
<% unless @record.new_record? %>
<input type="hidden" name="<%= "record#{scope}[id]" -%>" value="<%= @record.id -%>" />
<% end -%>
<% columns.each :flatten => true do |column| %>
  <%
  next if column.association and (column.association.klass == parent_record.class or !column.singular_association?)
  column = column.clone
  column.ui_type = :select if column.association
  -%>
  <li class="form-element">
    <%= render_form_field_for_column(column, :scope => scope) %>
  </li>
<% end -%>
  <li><%= link_to_function 'Remove', 'this.up(".association-record").remove()' -%></li>
</ol>